<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Word文档比较工具</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 20px;
            background-color: #f8f9fa;
            color: #333;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            background-color: #fff;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }
        h1 {
            text-align: center;
            color: #2c3e50;
            margin-bottom: 30px;
            font-weight: 600;
            padding-bottom: 15px;
            border-bottom: 2px solid #eaeaea;
        }
        .form-group {
            margin-bottom: 25px;
        }
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #2c3e50;
        }
        .file-input {
            width: 100%;
            padding: 12px;
            border: 1px solid #e3e3e3;
            border-radius: 6px;
            background-color: #f9f9f9;
            transition: border-color 0.3s, box-shadow 0.3s;
        }
        .file-input:hover, .file-input:focus {
            border-color: #4CAF50;
            outline: none;
            box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
        }
        .btn {
            display: inline-block;
            background-color: #4CAF50;
            color: white;
            padding: 14px 20px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            width: 100%;
            transition: all 0.3s ease;
            font-weight: 500;
        }
        .btn:hover {
            background-color: #45a049;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        .flash-messages {
            list-style: none;
            padding: 0;
            margin-bottom: 25px;
        }
        .flash-message {
            padding: 15px;
            border-radius: 6px;
            margin-bottom: 10px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        }
        .flash-message.error {
            background-color: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        .flash-message.success {
            background-color: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        .flash-message.info {
            background-color: #d1ecf1;
            color: #0c5460;
            border: 1px solid #bee5eb;
        }
        .description {
            background-color: #f1f8e9;
            padding: 20px;
            border-radius: 6px;
            margin-bottom: 30px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
            line-height: 1.8;
        }
        .description p {
            margin: 10px 0;
        }
        .description strong {
            color: #2c3e50;
        }
        
        /* 特性列表 */
        .features {
            margin: 30px 0;
            padding: 0;
            list-style-type: none;
        }
        .features li {
            padding: 10px 0 10px 30px;
            position: relative;
            border-bottom: 1px solid #f0f0f0;
        }
        .features li:before {
            content: "✓";
            position: absolute;
            left: 0;
            color: #4CAF50;
            font-weight: bold;
        }
        .features li:last-child {
            border-bottom: none;
        }
        
        /* 管理按钮区域 */
        .admin-controls {
            margin-top: 40px;
            padding: 20px;
            background-color: #f8f9fa;
            border-radius: 6px;
            border: 1px solid #e3e3e3;
        }
        .admin-controls h3 {
            margin-top: 0;
            color: #2c3e50;
            font-weight: 500;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eaeaea;
        }
        .btn-group {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
        }
        .btn-sm {
            padding: 8px 15px;
            font-size: 14px;
            border-radius: 4px;
            flex: 1;
            min-width: 120px;
            text-align: center;
        }
        .btn-danger {
            background-color: #dc3545;
        }
        .btn-danger:hover {
            background-color: #c82333;
        }
        .btn-warning {
            background-color: #ffc107;
            color: #212529;
        }
        .btn-warning:hover {
            background-color: #e0a800;
        }
        
        /* 页脚 */
        .footer {
            text-align: center;
            margin-top: 40px;
            padding-top: 20px;
            font-size: 12px;
            color: #777;
            border-top: 1px solid #eaeaea;
        }
        
        /* 响应式优化 */
        @media (max-width: 768px) {
            .container {
                padding: 20px;
            }
            h1 {
                font-size: 24px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Word文档比较工具</h1>
        
        <div class="description">
            <p>这个工具可以比较两个Word文档，并高亮显示它们之间的差异。上传两个要比较的文档，然后点击"比较文档"按钮。</p>
            <p><strong>主要特性：</strong></p>
            <ul class="features">
                <li>基于相似度的智能段落匹配</li>
                <li>保留原始文档的格式和样式</li>
                <li>直观的差异对比展示</li>
                <li>可下载包含高亮差异的文档</li>
            </ul>
            <p><strong>注意：</strong>仅支持.docx格式的文档。</p>
        </div>

        {% if get_flashed_messages() %}
        <ul class="flash-messages">
            {% for category, message in get_flashed_messages(with_categories=true) %}
            <li class="flash-message {{ category }}">{{ message }}</li>
            {% endfor %}
        </ul>
        {% endif %}
        
        <form action="{{ url_for('compare') }}" method="post" enctype="multipart/form-data">
            <div class="form-group">
                <label for="file1">第一个文档：</label>
                <input type="file" id="file1" name="file1" class="file-input" required accept=".docx">
            </div>
            
            <div class="form-group">
                <label for="file2">第二个文档：</label>
                <input type="file" id="file2" name="file2" class="file-input" required accept=".docx">
            </div>
            
            <button type="submit" class="btn">比较文档</button>
        </form>
        
        <div class="admin-controls">
            <h3>文件管理</h3>
            <div class="btn-group">
                <form action="{{ url_for('cleanup_uploads') }}" method="post" style="flex: 1;">
                    <button type="submit" class="btn btn-warning btn-sm" onclick="return confirm('确定要清理所有上传的文档吗？')">
                        清理上传文档
                    </button>
                </form>
                <form action="{{ url_for('cleanup_results') }}" method="post" style="flex: 1;">
                    <button type="submit" class="btn btn-warning btn-sm" onclick="return confirm('确定要清理所有结果文档吗？')">
                        清理结果文档
                    </button>
                </form>
                <form action="{{ url_for('cleanup_all') }}" method="post" style="flex: 1;">
                    <button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('确定要清理所有文档吗？这将删除所有上传的文档和生成的结果！')">
                        清理所有文档
                    </button>
                </form>
            </div>
        </div>
        
        <div class="footer">
            Word文档比对工具 v1.0 版本 | 基于相似度的智能段落匹配 | 作者: hk0369
        </div>
    </div>
</body>
</html> 